﻿using UnityEditor;

//增加一些小功能,无关紧要。
public class EditorHelper {
	[MenuItem("Assets/复制当前资源路径")]
	static void CopyCurrentResPath(){
		var assetPath = AssetDatabase.GUIDToAssetPath (Selection.assetGUIDs[0]);
		int index = assetPath.IndexOf ("Res/");
		if (index > 0) {
			assetPath = assetPath.Substring (index + 4);
			EditorGUIUtility.systemCopyBuffer = assetPath;
			return;
		}
		index = assetPath.IndexOf ("Resources/");
		if (index > 0) {
			assetPath = assetPath.Substring (index + 10);
			EditorGUIUtility.systemCopyBuffer = assetPath;
			return;
		}
		index = assetPath.IndexOf ("Assets");
		if (index > 0) {
			assetPath = assetPath.Substring (index + 6);
			EditorGUIUtility.systemCopyBuffer = assetPath;
			return;
		}
		EditorGUIUtility.systemCopyBuffer = "";
	}
}
